$(function () {
  chrome.storage.sync.get("limit", function (bunget) {
    $("#limit").val(bunget.limit)
  })

  $("#saveLimit").click(function () {
    let limit = $("#limit").val();
    if (limit) {
      chrome.storage.sync.set({ limit }, function () {
        close();
      })
    }
  })
  $("#clearAmount").click(function () {
    chrome.storage.sync.set({ total: 0 });
    let notifyOptions = {
      type: "basic",
      title: "提示",
      iconUrl: "img/logo.png",
      message: "你的总金额已清零"
    }
    chrome.notifications.create("clearAmount", notifyOptions);
  })
})